<?php

namespace App\Http\Requests\Common\EnumData\Enumop\Video;

use App\Http\Requests\Request;

class VyearRequest extends Request
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch($this->method())
        {
            case 'GET':
            case 'DELETE':
            {
                return [];
            }
            // Crate
            case 'POST':
            {
                return [
                    'name' => 'required|max:100',
                    'title' => 'max:100',
                    'subtitle' => 'max:100',
                    'short_desc' => 'max:100'
                ];
            }
            // UPDATE
            case 'PUT':
            case 'PATCH':
            {
                // $id = $this->route('vyears');
                return [
                    'name' => 'required|max:100',
                    'title' => 'max:100',
                    'subtitle' => 'max:100',
                    'short_desc' => 'max:100'
                ];
            }
            default:
                break;
        }
    }
     public function messages()
    {
        return [
            'name.required'       => '名称 不能为空',
            'short_desc.required' => '简介 不能为空',
            'title.max'       => '标题 不能大于 :100',
            'subtitle.max'   => '副标题 不能大于 :100',
        ];
    }
}
